Repository navigation
feat(ai-research): keep v4 url history per team month - #117983
trunk-io[bot] merged 1 commit into
Conversation
🤖 CI report🚨 Trunk lane — universal laneThis PR is assigned to the universal lane. It cannot merge in parallel with other PRs, so it can take longer to merge. Ask dev-ex if you think this is wrong. ✅ Duplication (Python) — cleanNew Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.
|
| First copy | Second copy | Lines | Tokens |
|---|---|---|---|
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.test.ts:156 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.test.ts:129 |
210 | 1812 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:151 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:132 |
138 | 899 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.test.ts:6 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.test.ts:5 |
91 | 714 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:442 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:402 |
65 | 441 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.integration.test.ts:1 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.integration.test.ts:1 |
66 | 438 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:37 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:31 |
47 | 282 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.test.ts:106 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.test.ts:92 |
25 | 213 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:324 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:291 |
25 | 209 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:304 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:271 |
21 | 175 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:122 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:103 |
30 | 162 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:398 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:361 |
24 | 156 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/crawl-history.ts:25 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/crawl-history.ts:19 |
28 | 120 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:83 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:77 |
14 | 109 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:362 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:328 |
21 | 102 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:97 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:90 |
20 | 84 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts:348 |
nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror-image-fetch/dynamodb-crawl-history.ts:315 |
13 | 81 |
✅ Comment density — 2% of added code lines are comments (20 of 975)
This section warns when comments are more than 3% of the code lines a PR adds, and alerts above 6%. Before agent-assisted PRs, the typical share was about 2%. Only full-line comments count. Docstrings, generated files, snapshots, migrations, and workflow files are left out.
Comments that restate the code, record how the change came about, or narrate the next line add noise for the next reader. Keep the comments that explain a reason the code cannot show, and remove the rest. See .agents/skills/writing-code-comments/SKILL.md for the house rules.
Files with the most added comment lines:
| File | Comment lines | Added lines |
|---|---|---|
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/dynamodb-crawl-history.ts |
9 | 471 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/url-history-expiry.ts |
7 | 24 |
nodejs/src/ingestion/pipelines/sessionreplay/ai-research/image-fetch-v4/crawl-history.ts |
4 | 46 |
This check does not block merging. It updates on every push and clears when the share drops.
|
[Medium impact] Changes image fetch history expiry logic for a new URL format. The missing-result convention must be fixed before merging; the cache test gap is non-blocking. Reviews (1) · Last reviewed commit: "feat(ml-image-fetch): keep v4 url histor..." · Reviewed by Greptile |
b2adf74 to
f3fb18e
Compare
|
Risk: No findings This increment hardens the v4 crawl-history store: malformed DynamoDB rows now read as cache misses with a warning instead of failing the batch, legacy rows carrying a plaintext response URL are stripped on read so their validators read as unbound, the cache field becomes a keyed hash ( Sentinel reviewed |
f3fb18e to
30969e6
Compare
30969e6 to
7b85b05
Compare
7b85b05 to
7135717
Compare
7135717 to
446e6d3
Compare
446e6d3 to
dbfe1fe
Compare
dbfe1fe to
173603c
Compare
|
Written by Claude on Robbie's behalf, from a QA review of the v4 stack. These are minor findings: none of them blocks the merge.
|
|
Written by Claude on Robbie's behalf, from a QA review of the v4 stack. The fetch history keeps the full image URL in plaintext for months.
With both, the table holds no URL, and each item goes away a few weeks after its month. Fixing this before the first sync avoids a table scan to clean up rows already written. |
173603c to
05760b0
Compare
| const [year, month] = v4.keyMonth.split('-').map(Number) | ||
| return Date.UTC(year, month, 1 + MONTH_GRACE_DAYS) |
There was a problem hiding this comment.
P2 · Retain URL history until the team-month key expires
For an October reference, this returns November 9, while teamMonthKeyExpiresAtMs('2026-10') returns March 1. The history therefore loses storedAtMs and validators while the key remains valid, even before a mid-October fetch reaches its 30-day refetch date. Late jobs fetch again instead of reusing that history; use teamMonthKeyExpiresAtMs(v4.keyMonth) for storage expiry.
Gives the v4 fetch lane its own crawl history, copied from the v3 fetcher and cut to v4 references. It lives in one DynamoDB table of its own, which holds the URL history of each imageurl:v4 reference and the robots.txt and tdmrep entries of each origin. The lane reads and writes no v3 crawl history table. - A v4 reference is fetched again after the crawl history TTL (30 days) or the response's freshness, whichever is later, and is revalidated with ETag or Last-Modified. - Its entry expires 8 days after the end of its month, as in v3. A reference carries the month it was written in, so no job for it comes after that. - An item that does not parse reads as a cache miss, with a log line and a counter, so one bad row cannot fail every batch. - An entry holds a keyed hash of the response URL, never the URL. - An entry records storedAtMs, when the lane last stored or refreshed the image of the reference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
05760b0 to
8abad90
Compare
|
This pull request was merged into |
Problem
Changes
imageurl:v4reference and the robots.txt and tdmrep entries of each origin.storedAtMs, when the lane last stored or refreshed the image, so the lane knows when a stored copy needs a refresh.How did you test this code?
jest dynamodb-crawl-history url-history-expiry: batching, retries, malformed items, chunked configuration bodies, access checks, and the v4 refetch and expiry rule.Test rationale: a v4 history entry that outlived its key would keep a URL marked fetched after its image expired.
Release status
Docs update
None. The format is in
products/ai_training/docs/replay-data.md(#117905).🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Agent: Claude Code, Claude Opus 5.5 (1M context)
/stacking-prs,/writing-tests,/writing-pr-descriptions.🤖 Generated with Claude Code